<?xml version="1.0" encoding="UTF-8"?>
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="./css/template.css" />
        <link type="text/css" rel="stylesheet" href="./css/SyntaxHighlighter.css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Refactoring in Eclipse</title>
        <script language="javascript" src="./js/shInit.js" />
        <script language="javascript" src="./js/shCore.js" />
        <script language="javascript" src="./js/shBrushCpp.js" />
        <script language="javascript" src="./js/shBrushCSharp.js" />
        <script language="javascript" src="./js/shBrushCss.js" />
        <script language="javascript" src="./js/shBrushDelphi.js" />
        <script language="javascript" src="./js/shBrushJava.js" />
        <script language="javascript" src="./js/shBrushJScript.js" />
        <script language="javascript" src="./js/shBrushPhp.js" />
        <script language="javascript" src="./js/shBrushPython.js" />
        <script language="javascript" src="./js/shBrushRuby.js" />
        <script language="javascript" src="./js/shBrushSql.js" />
        <script language="javascript" src="./js/shBrushVb.js" />
        <script language="javascript" src="./js/shBrushXml.js" />
        <keywords>sun,java,eclipse,3.3,refactoring</keywords>
        <author>Jérémie DELLISSE</author>
    </head>
    <body>
        <div class="chapter">
            <h2>Introduction</h2>
            <p>
                The following is related to Eclipse version 3.3
                <br />
                <br />
                "Refactoring" allows automated modification of source code parts in the whole program,
				without editing everything manually and without altering the program performance. It is freed from mistakes,
				while an omission is frequent when doing it manually.
                <br />
                <br />
                Refactoring is useful either for updating a program, optimising it, restructuring it while adding functionnalities
				or simply giving you a hand with its creation.
            </p>
        </div>
        <div class="chapter">
            <h2>Access to refactoring function</h2>
            <p>Right-clic on the area of code you want to edit or use Alt+Shift+T keyboard shortcut to access refactoring.</p>
            <img src="./images/refactoring1.png" border="1" />
            <p>
                The menu only displays functions available for this code. Do not be surprised if you cannot see all methods in the menu.
                <br />
                <br />
                You may see a wizard, depending on the function complexity.
                <br />
                <br />
                You can also access refactoring via "Refactor" in the menu bar.
                <br />
                <br />
                Most of the options that will be presented below offer you a "Preview" button to get a glimpse of the modifications
				before applying them to the code.
            </p>
            <img src="./images/refactoring2.png" width="100%" />
        </div>
        <div class="chapter">
            <h2>Available functions</h2>
            <div class="subChapter">
                <h3>Rename</h3>
                <p>
                    Renames the selected item (class, method or variable) and modifies calls to it.
                    <br />
                    Shortcut : Alt+Shift+R.
                </p>
                <img src="./images/refactoring3.png" border="1" />
            </div>
            <div class="subChapter">
                <h3>Move</h3>
                <p>
                    Moves the selected item to another package or class.
                    <br />
                    Shortcut : Alt+Shift+V
                </p>
                <img src="./images/refactoring4.png" />
                <br />
                <br />
                <img src="./images/refactoring5.png" />
            </div>
            <div class="subChapter">
                <h3>Change Method Signature</h3>
                <p>
                    Changes a method's access level, signature, return type, parameters (names, types and order) or exceptions it may throw...
                    <br />
                    Shortcut : Alt+Shift+C
                </p>
                <img src="./images/refactoring6.png" />
            </div>
            <div class="subChapter">
                <h3>Extract Method</h3>
                <p>
                    Encapsulates selected items in a new method and replaces references to these items by calls to the method.
                    <br />
                    Shortcut : Alt+Shift+M
                </p>
            </div>
            <div class="subChapter">
                <h3>Extract Local Variable</h3>
                <p>
                    Similar to the previous one, except that it encapsulates the selected expression in a variable.
                    <br />
                    Shortcut : Alt+Shift+L
                </p>
            </div>
            <div class="subChapter">
                <h3>Extract Constant</h3>
                <p>
                    Replaces an expression by a call to a <i>static</i> and <i>final</i> class field defined
					from this expression.
					An option allows to replace the expression occurrences by a call to this constant.
                </p>
            </div>
            <div class="subChapter">
                <h3>Inline</h3>
                <p>
                    Is the opposite of
                    <i>Extract Local Variable</i>
                    : it replaces the selected variable by its expression.
                    <br />
                    Shortcut : Alt+Shift+I
                </p>
            </div>
            <div class="subChapter">
                <h3>Convert Anonymous Class to Nested</h3>
                <p>Transforms a too heavy anonymous class in a nested class in its own file.
					Just put the cursor anywhere in the class to make this function available.</p>
            </div>
            <div class="subChapter">
                <h3>Convert Member Type to Top Level</h3>
                <p>Creates a new class for the selected member type.</p>
            </div>
            <div class="subChapter">
                <h3>Convert Local Variable to Field</h3>
                <p>Changes a local variable into a class field.</p>
            </div>
            <div class="subChapter">
                <h3>Extract Superclass</h3>
                <p>Creates a parent class for the selected object.</p>
            </div>
            <div class="subChapter">
                <h3>Extract Interface</h3>
                <p>Analyses selected items and creates an interface which the current class will implement.</p>
            </div>
            <div class="subChapter">
                <h3>Use Supertype where possible</h3>
                <p>
                    Analyses the code and replaces types by one of their
                    <i>supertypes</i>
                    wherever it is possible
                </p>
            </div>
            <div class="subChapter">
                <h3>Push down / push up</h3>
                <p>Moves the selection to a child / parent class.</p>
            </div>
            <div class="subChapter">
                <h3>Introduce Indirection</h3>
                <p>Creates an indirect addressing method that delegates the selected method.</p>
            </div>
            <div class="subChapter">
                <h3>Introduce Factory</h3>
                <p>Creates a method that calls the selected constructor and returns the created object. Calls to the constructor are all replaced by calls to this method.</p>
            </div>
            <div class="subChapter">
                <h3>Introduce Parameter</h3>
                <p>Replaces the selected expression by a parameter of the current method and modifies calls to this method.</p>
            </div>
            <div class="subChapter">
                <h3>Generalize Declared Type</h3>
                <p>
                    Opens a wizard that indicates which
                    <i>supertypes</i>
                    may replace the selection's type.
                </p>
                <img src="./images/refactoring7.png" />
            </div>
            <div class="subChapter">
                <h3>Infer Generic Type Arguments</h3>
                <p>Replaces generic types by more specific ones whenever it is possible.</p>
            </div>
            <div class="subChapter">
                <h3>Migrate JAR file</h3>
                <p>Updates a JAR used by your program and prevents mistakes implied by this update.</p>
            </div>
            <div class="subChapter">
                <h3>Create Script</h3>
                <p>Creates a script of refactoring operations applied to the workspace. This script can be saved as a file or copied into the clipboard.</p>
            </div>
            <div class="subChapter">
                <h3>Apply script</h3>
                <p>Applies scripts created by the function above.</p>
            </div>
            <div class="subChapter">
                <h3>History</h3>
                <p>Displays an history of refactoring operations applied to the workspace and allows to remove them from the history.</p>
            </div>
        </div>
    </body>
</html>

